using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Drawing;
using System.Web;
namespace BlogControl
{
    public partial class Blog
    {
        #region Calendar
        [Category("Archives")]
        [Description("Draw external calendar, if this value is set to true, you must set the \"CalendarID\" value")]
        public bool DrawExternalCalendar
        {
            get
            {
                if (ViewState["DrawExternalCalendar"] != null)
                {
                    return (bool)ViewState["DrawExternalCalendar"];
                }
                return false;
            }
            set
            {
                ViewState["DrawExternalCalendar"] = value;
            }
        }
        [Category("Archives")]
        [Description("The id of the calendar in the page")]
        public string CalendarID
        {
            get
            {
                if (ViewState["CalendarID"] != null)
                {
                    return (string)ViewState["CalendarID"];
                }
                return null;
            }
            set
            {
                ViewState["CalendarID"] = value;
            }
        }
      

        #endregion
        #region Data
        /// <summary>
        /// the directory to the posts files
        /// </summary>
        [Category("Misc")]
        [Description("The directory for the post files")]
        public string Directory
        {
            get
            {
                if (ViewState["_directory"] != null)
                {
                    return (string)ViewState["_directory"];
                }
                else throw new System.ArgumentNullException("Directory");
            }
            set
            {

                if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath( value)))
                {
                    System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath( value));
                }
                ViewState["_directory"] = value;
            }
        }

        [Category("Data")]
        [Description("The format of the dates to display")]
        [DefaultValue("yyyy-MM-dd")]
        public string DateFormat
        {
            get
            {
                if (ViewState["DateFormat"] != null)
                {
                    return (string)ViewState["DateFormat"];
                }
                else return "yyyy-MM-dd";
            }
            set
            {
                ViewState["DateFormat"] = value;
            }
        }

        [Category("Data")]
        [Description("The text to display in case no posts were found")]
        public string NoPostsText
        {
            get
            {
                if (ViewState["NoPostsText"] != null)
                {
                    return (string)ViewState["NoPostsText"];
                }
                else return null;
            }
            set
            {
                ViewState["NoPostsText"] = value;
            }
        }
        [Category("Styles")]
        [Description("The css class of the text to display in case no posts were found")]
        public string NoPostsCSS
        {
            get
            {
                if (ViewState["NoPostsCSS"] != null)
                {
                    return (string)ViewState["NoPostsCSS"];
                }
                else return null;
            }
            set
            {
                ViewState["NoPostsCSS"] = value;
            }
        }

        [Category("Appearance")]
        [Description("The forecolor of the text to display in case no posts were found")]
        [DefaultValue(typeof(Color),"Black")]
        public Color NoPostsColor
        {
            get
            {
                if (ViewState["NoPostsColor"] != null)
                {
                    return (Color)ViewState["NoPostsColor"];
                }
                else return Color.Black;
            }
            set
            {
                ViewState["NoPostsColor"] = value;
            }
        }
        #endregion
        #region Comments

        [Description("The color of a line separator between comments")]
        [Category("Comments")]
        [DefaultValue(typeof(Color), "Silver")]
        public Color CommentsSeparatorColor
        {
            get
            {
                if (ViewState["CommentsSeparatorColor"] != null)
                {
                    return (Color)ViewState["CommentsSeparatorColor"];
                }
                else return Color.Silver;


            }
            set
            {
                ViewState["CommentsSeparatorColor"] = value;
            }
        }

        [Description("Comments line separator css class")]
        [Category("Comments")]
        public string CommentsSeparatorCSS
        {
            get
            {
                if (ViewState["CommentsSeparatorCSS"] != null)
                {
                    return (string)ViewState["CommentsSeparatorCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["CommentsSeparatorCSS"] = value;
            }
        }


        [Description("Add line separator between comments")]
        [Category("Comments")]
        [DefaultValue(true)]
        public bool ShowCommentsSeparator
        {
            get
            {
                if (ViewState["ShowCommentsSeparator"] != null)
                {
                    return (bool)ViewState["ShowCommentsSeparator"];
                }
                else return true;


            }
            set
            {
                ViewState["ShowCommentsSeparator"] = value;
            }
        }

        [Description("The color of a \"Add Comment\" link color")]
        [Category("Comments")]
        [DefaultValue(typeof(Color), "Black")]
        public Color AddCommentLinkColor
        {
            get
            {
                if (ViewState["AddCommentLinkColor"] != null)
                {
                    return (Color)ViewState["AddCommentLinkColor"];
                }
                else return Color.Black;


            }
            set
            {
                ViewState["AddCommentLinkColor"] = value;
            }
        }

        [Description("The color of comments box fonts")]
        [Category("Comments")]
        [DefaultValue(typeof(Color), "Black")]
        public Color AddCommentsBoxTextColor
        {
            get
            {
                if (ViewState["AddCommentsBoxTextColor"] != null)
                {
                    return (Color)ViewState["AddCommentsBoxTextColor"];
                }
                else return Color.Black;


            }
            set
            {
                ViewState["AddCommentsBoxTextColor"] = value;
            }
        }
        [Description("The color of a comment subject")]
        [Category("Comments")]
        [DefaultValue(typeof(Color),"Black")]
        public Color CommentsSubjectColor
        {
            get
            {
                if (ViewState["CommentsSubjectColor"] != null)
                {
                    return (Color)ViewState["CommentsSubjectColor"];
                }
                else return Color.Black;


            }
            set
            {
                ViewState["CommentsSubjectColor"] = value;
            }
        }

        [Description("The color of a comment author")]
        [Category("Comments")]
        [DefaultValue(typeof(Color), "Black")]
        public Color CommentsAuthorColor
        {
            get
            {
                if (ViewState["CommentsAuthorColor"] != null)
                {
                    return (Color)ViewState["CommentsAuthorColor"];
                }
                else return Color.Black;


            }
            set
            {
                ViewState["CommentsAuthorColor"] = value;
            }
        }

        [Description("The color of a comment publish date")]
        [Category("Comments")]
        [DefaultValue(typeof(Color), "Black")]
        public Color CommentsPublishDateColor
        {
            get
            {
                if (ViewState["CommentsPublishDateColor"] != null)
                {
                    return (Color)ViewState["CommentsPublishDateColor"];
                }
                else return Color.Black;


            }
            set
            {
                ViewState["CommentsPublishDateColor"] = value;
            }
        }

        [Description("The color of a comment body")]
        [Category("Comments")]
        [DefaultValue(typeof(Color), "Black")]
        public Color CommentsBodyColor
        {
            get
            {
                if (ViewState["CommentsBodyColor"] != null)
                {
                    return (Color)ViewState["CommentsBodyColor"];
                }
                else return Color.Black;


            }
            set
            {
                ViewState["CommentsBodyColor"] = value;
            }
        }


        /// <summary>
        /// Add comment box css class
        /// </summary>
        [Description("Add comment box css class")]
        [Category("Comments")]
        public string AddCommentBoxCSS
        {
            get
            {
                if (ViewState["AddCommentBoxCSS"] != null)
                {
                    return (string)ViewState["AddCommentBoxCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["AddCommentBoxCSS"] = value;
            }
        }
        /// <summary>
        /// The submit comment button css class on the comments box
        /// </summary>
        [Description("The submit comment button css class on the comments box")]
        [Category("Comments")]
        public string AddCommentSubmitButtonCSS
        {
            get
            {
                if (ViewState["AddCommentSubmitButtonCSS"] != null)
                {
                    return (string)ViewState["AddCommentSubmitButtonCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["AddCommentSubmitButtonCSS"] = value;
            }
        }

        /// <summary>
        /// The text area css class on the comments box
        /// </summary>
        [Description("The text area css class on the comments box")]
        [Category("Comments")]
        public string AddCommentTextAreaCSS
        {
            get
            {
                if (ViewState["AddCommentTextAreaCSS"] != null)
                {
                    return (string)ViewState["AddCommentTextAreaCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["AddCommentTextAreaCSS"] = value;
            }
        }
        /// <summary>
        /// "Add Comment" link css class
        /// </summary>
        [Description("\"Add Comment\" link css class")]
        [Category("Comments")]
        public string AddCommentLinkCSS
        {
            get
            {
                if (ViewState["AddCommentLinkCSS"] != null)
                {
                    return (string)ViewState["AddCommentLinkCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["AddCommentLinkCSS"] = value;
            }
        }
        /// <summary>
        /// The cancel comment button css class on the comments box
        /// </summary>
        [Description("The cancel comment button css class on the comments box")]
        [Category("Comments")]
        public string AddCommentCancelButtonCSS
        {
            get
            {
                if (ViewState["AddCommentCancelButtonCSS"] != null)
                {
                    return (string)ViewState["AddCommentCancelButtonCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["AddCommentCancelButtonCSS"] = value;
            }
        }

        /// <summary>
        /// Comments view - subject css
        /// </summary>
        [Description("Comments view - subject css")]
        [Category("Comments")]
        public string CommentsViewSubjectCSS
        {
            get
            {
                if (ViewState["CommentsViewSubjectCSS"] != null)
                {
                    return (string)ViewState["CommentsViewSubjectCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["CommentsViewSubjectCSS"] = value;
            }
        }

        /// <summary>
        /// Comments view - author css
        /// </summary>
        [Description("Comments view - author css")]
        [Category("Comments")]
        public string CommentsViewAuthorCSS
        {
            get
            {
                if (ViewState["CommentsViewAuthorCSS"] != null)
                {
                    return (string)ViewState["CommentsViewAuthorCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["CommentsViewAuthorCSS"] = value;
            }
        }

        /// <summary>
        /// Comments view - publish date css
        /// </summary>
        [Description("Comments view - publish date css")]
        [Category("Comments")]
        public string CommentsViewPublishDateCSS
        {
            get
            {
                if (ViewState["CommentsViewPublishDateCSS"] != null)
                {
                    return (string)ViewState["CommentsViewPublishDateCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["CommentsViewPublishDateCSS"] = value;
            }
        }


        /// <summary>
        /// Post comments count css class
        /// </summary>
        [Description("Post comments count css class")]
        [Category("Comments")]
        public string CommentsCountCSS
        {
            get
            {
                if (ViewState["CommentsCountCSS"] != null)
                {
                    return (string)ViewState["CommentsCountCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["CommentsCountCSS"] = value;
            }
        }

        /// <summary>
        /// Comments view css class
        /// </summary>
        [Description("Comments view css class")]
        [Category("Comments")]
        public string CommentsViewCSS
        {
            get
            {
                if (ViewState["CommentsViewCSS"] != null)
                {
                    return (string)ViewState["CommentsViewCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["CommentsViewCSS"] = value;
            }
        }
        /// <summary>
        /// The text of the user name label on the comments box
        /// </summary>
        [DefaultValue("Name")]
        [Description("The text of the user name label on the comments box")]
        [Category("Comments")]
        public string AddCommentUserNameText
        {
            get
            {
                if (ViewState["AddCommentUserNameText"] != null)
                {
                    return (string)ViewState["AddCommentUserNameText"];
                }
                else return "Name";


            }
            set
            {
                ViewState["AddCommentUserNameText"] = value;
            }
        }


        /// <summary>
        /// The text of the Subject label on the comments box
        /// </summary>
        [DefaultValue("Subject")]
        [Description(" The text of the Subject label on the comments box")]
        [Category("Comments")]
        public string AddCommentSubjectText
        {
            get
            {
                if (ViewState["AddCommentSubjectText"] != null)
                {
                    return (string)ViewState["AddCommentSubjectText"];
                }
                else return "Subject";


            }
            set
            {
                ViewState["AddCommentSubjectText"] = value;
            }
        }

        /// <summary>
        /// The text of the Message label on the comments box
        /// </summary>
        [DefaultValue("Message")]
        [Description(" The text of the Message label on the comments box")]
        [Category("Comments")]
        public string AddCommentMessageText
        {
            get
            {
                if (ViewState["AddCommentMessageText"] != null)
                {
                    return (string)ViewState["AddCommentMessageText"];
                }
                else return "Message";


            }
            set
            {
                ViewState["AddCommentMessageText"] = value;
            }
        }

        /// <summary>
        /// The text on the send comment button on the comments box
        /// </summary>
        [DefaultValue("Submit")]
        [Description("The text on the send comment button on the comments box")]
        [Category("Comments")]
        public string AddCommentSubmitText
        {
            get
            {
                if (ViewState["AddCommentSubmitText"] != null)
                {
                    return (string)ViewState["AddCommentSubmitText"];
                }
                else return "Submit";


            }
            set
            {
                ViewState["AddCommentSubmitText"] = value;
            }
        }
        /// <summary>
        /// The text on the cancel comment button on the comments box
        /// </summary>
        [DefaultValue("Cancel")]
        [Description("The text on the cancel comment button on the comments box")]
        [Category("Comments")]
        public string AddCommentCancelText
        {
            get
            {
                if (ViewState["AddCommentCancelText"] != null)
                {
                    return (string)ViewState["AddCommentCancelText"];
                }
                else return "Cancel";


            }
            set
            {
                ViewState["AddCommentCancelText"] = value;
            }
        }

        /// <summary>
        /// The number of columns on the add comment text area
        /// </summary>
        [DefaultValue(20)]
        [Description("The number of columns on the add comment text area")]
        [Category("Comments")]
        public int AddCommentTextAreaColumns
        {
            get
            {
                if (ViewState["AddCommentTextAreaColumns"] != null)
                    return (int)ViewState["AddCommentTextAreaColumns"];
                else
                    return 20;
            }
            set
            {
                ViewState["AddCommentTextAreaColumns"] = value;
            }
        }

        /// <summary>
        /// The number of rows on the add comment text area
        /// </summary>
        [DefaultValue(5)]
        [Description("The number of rows on the add comment text area")]
        [Category("Comments")]
        public int AddCommentTextAreaRows
        {
            get
            {
                if (ViewState["AddCommentTextAreaRows"] != null)
                    return (int)ViewState["AddCommentTextAreaRows"];
                else
                    return 5;
            }
            set
            {
                ViewState["AddCommentTextAreaRows"] = value;
            }
        }
        /// <summary>
        /// Display comments count on posts preview page
        /// </summary>
        [DefaultValue(true)]
        [Description("Show comments count next to each posts on the preview page")]
        [Category("Comments")]
        public bool ShowCommentsCountOnPreviewPage
        {
            get
            {
                if (ViewState["ShowCommentsCountOnPreviewPage"] != null)
                {
                    return (bool)ViewState["ShowCommentsCountOnPreviewPage"];
                }
                return true;
            }
            set
            {
                ViewState["ShowCommentsCountOnPreviewPage"] = value;
            }
        }

        /// <summary>
        /// Show comments count next to the post title on a single post view
        /// </summary>
        [DefaultValue(true)]
        [Description("Show comments count next to the post title on a single post view")]
        [Category("Comments")]
        public bool ShowCommentsCountOnSinglePostView
        {
            get
            {
                if (ViewState["ShowCommentsCountOnSinglePostView"] != null)
                {
                    return (bool)ViewState["ShowCommentsCountOnSinglePostView"];
                }
                return true;
            }
            set
            {
                ViewState["ShowCommentsCountOnSinglePostView"] = value;
            }
        }

        /// <summary>
        /// "Add Comment" link text
        /// </summary>
        [DefaultValue("Add Comment")]
        [Description("\"Add Comment\" link text")]
        [Category("Comments")]
        public string AddCommentLinkText
        {
            get
            {
                if (ViewState["AddCommentLinkText"] != null)
                {
                    return (string)ViewState["AddCommentLinkText"];
                }
                else return "Add Comment";


            }
            set
            {
                ViewState["AddCommentLinkText"] = value;
            }
        }

        /// <summary>
        /// Comments label text
        /// </summary>
        [DefaultValue("comments")]
        [Description("Comments label text")]
        [Category("Comments")]
        public string CommentLabelText
        {
            get
            {
                if (ViewState["CommentLabelText"] != null)
                {
                    return (string)ViewState["CommentLabelText"];
                }
                else return "comments";


            }
            set
            {
                ViewState["CommentLabelText"] = value;
            }
        }
        private Style _styleComments;
        private FontInfo _commentsFont;
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [Category("PostSubject")]
        [NotifyParentProperty(true)]
        [Description("The font for the comments")]
        public FontInfo CommentsFont
        {
            get
            {
                if (_styleComments == null)
                {
                    if (ViewState["CommentsFont"] != null)
                    {

                    }
                    _styleComments = new Style();
                    _commentsFont = _styleComments.Font;
                    _commentsFont.Name = "Verdana";
                    _commentsFont.Size = FontUnit.Parse("11px");
                }
                return _commentsFont;
            }
            set
            {
                ViewState["CommentsFont"] = value;
                _commentsFont = value;
            }
        }

        [DefaultValue(typeof(System.Drawing.Color), "#5c80b1")]
        [Description("The comments color")]
        [Category("Comments")]
        public Color CommentsCountColor
        {
            get
            {
                if (ViewState["CommentsCountColor"] != null)
                {
                    return (Color)ViewState["CommentsCountColor"];
                }
                return ColorTranslator.FromHtml("#5c80b1");
            }
            set
            {
                ViewState["CommentsCountColor"] = value;
            }
        }
        /// <summary>
        /// Allow users to add comments on a single post view
        /// </summary>
        [DefaultValue(true)]
        [Description("Allow users to add comments on a single post view")]
        [Category("Comments")]
        public bool AllowComments
        {
            get
            {
                if (ViewState["AllowComments"] != null)
                {
                    return (bool)ViewState["AllowComments"];
                }
                return true;
            }
            set
            {
                ViewState["AllowComments"] = value;
            }
        }

        /// <summary>
        /// Allow users to add comments on the preview page
        /// </summary>
        [DefaultValue(true)]
        [Description("Allow users to add comments on the preview page")]
        [Category("Comments")]
        public bool AllowCommentsOnPreviewPage
        {
            get
            {
                if (ViewState["AllowCommentsOnPreviewPage"] != null)
                {
                    return (bool)ViewState["AllowCommentsOnPreviewPage"];
                }
                return true;
            }
            set
            {
                ViewState["AllowCommentsOnPreviewPage"] = value;
            }
        }

        /// <summary>
        /// Display comments on posts preview page
        /// </summary>
        [DefaultValue(false)]
        [Description("Show comments on the preview page")]
        [Category("Comments")]
        public bool ShowCommentsOnPreviewPage
        {
            get
            {
                if (ViewState["ShowCommentsOnPreviewPage"] != null)
                {
                    return (bool)ViewState["ShowCommentsOnPreviewPage"];
                }
                return false;
            }
            set
            {
                ViewState["ShowCommentsOnPreviewPage"] = value;
            }
        }

        /// <summary>
        /// Show comments on a single post view page
        /// </summary>
        [DefaultValue(true)]
        [Description("Show comments on a single post view page")]
        [Category("Comments")]
        public bool ShowCommentsOnSinglePostPage
        {
            get
            {
                if (ViewState["ShowCommentsOnSinglePostPage"] != null)
                {
                    return (bool)ViewState["ShowCommentsOnSinglePostPage"];
                }
                return false;
            }
            set
            {
                ViewState["ShowCommentsOnSinglePostPage"] = value;
            }
        }
        #endregion
        #region PostSubject
        /// <summary>
        /// Display the post writer
        /// </summary>
        [DefaultValue(true)]
        [Description("Show the name of the post writer")]
        [Category("PostSubject")]
        public bool ShowPostWriter
        {
            get
            {
                if (ViewState["ShowPostWriter"] != null)
                {
                    return (bool)ViewState["ShowPostWriter"];
                }
                return true;
            }
            set
            {
                ViewState["ShowPostWriter"] = value;
            }
        }
        /// <summary>
        /// Post subject css class on the preview page
        /// </summary>
        [Description("Post subject css class")]
        [Category("PostSubject")]
        public string PostSubjectCSS
        {
            get
            {
                if (ViewState["PostSubjectCSS"] != null)
                {
                    return (string)ViewState["PostSubjectCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["PostSubjectCSS"] = value;
            }
        }
        /// <summary>
        /// Show the post publish date
        /// </summary>
        [DefaultValue(true)]
        [Description("Show the post publication date")]
        [Category("PostSubject")]
        public bool ShowPostPublishDate
        {
            get
            {
                if (ViewState["ShowPostPublishDate"] != null)
                {
                    return (bool)ViewState["ShowPostPublishDate"];
                }
                return true;
            }
            set
            {
                ViewState["ShowPostPublishDate"] = value;
            }
        }
        /// <summary>
        /// Post publish date css class on preview page
        /// </summary>
        [Description("Post publish date css class")]
        [Category("PostSubject")]
        public string PostPublishDateCSS
        {
            get
            {
                if (ViewState["PostPublishDateCSS"] != null)
                {
                    return (string)ViewState["PostPublishDateCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["PostPublishDateCSS"] = value;
            }
        }

        [DefaultValue("by ")]
        [Description("Post writer format - you can use text with {0} for substituting with writer name")]
        [Category("PostSubject")]
        public string PostWriterFormat
        {
            get
            {
                if (ViewState["PostWriterFormat"] != null)
                {
                    return (string)ViewState["PostWriterFormat"];
                }
                else return "by ";


            }
            set
            {
                ViewState["PostWriterFormat"] = value;
            }
        }

        /// <summary>
        /// Post writer css class on preview page
        /// </summary>
        [Description("Post writer css class")]
        [Category("PostSubject")]
        public string PostWriterCSS
        {
            get
            {
                if (ViewState["PostWriterCSS"] != null)
                {
                    return (string)ViewState["PostWriterCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["PostWriterCSS"] = value;
            }
        }

        [Browsable(false)]
        public override FontInfo Font
        {
            get
            {
                return base.Font;
            }
        }

      
        private Style _styleSubject;
        private FontInfo _subjectFont;

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [Category("PostSubject")]
        [NotifyParentProperty(true)]
        [Description("The font for the post subject")]
        public FontInfo SubjectFont
        {
            get
            {
                if (_subjectFont == null)
                {
                    if (ViewState["SubjectFont"] != null)
                    {

                    }
                    _styleSubject = new Style();
                    _subjectFont = _styleSubject.Font;
                    _subjectFont.Name = "Verdana";
                    _subjectFont.Underline = false;
                    _subjectFont.Size = FontUnit.Parse("15px");
                }
                return _subjectFont;
            }
            set
            {
                ViewState["SubjectFont"] = value;
               _subjectFont = value; 
            }
        }
       
        private Style _styleDate;
        private FontInfo _dateFont;
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [Category("PostSubject")]
        [NotifyParentProperty(true)]
        [Description("The font for the post author/publish date")]
        public FontInfo DateAuthorFont
        {
            get
            {
                if (_styleDate == null)
                {
                    if (ViewState["DateAuthorFont"] != null)
                    {

                    }
                    _styleDate = new Style();
                    _dateFont = _styleDate.Font;
                    _dateFont.Name = "Verdana";
                    _dateFont.Size = FontUnit.Parse("10px");
                }
                return _dateFont;
            }
            set
            {
                ViewState["DateAuthorFont"] = value;
                _dateFont = value;
            }
        }
      
        [DefaultValue(typeof(System.Drawing.Color), "#666666")]
        [Description("The post author/date color")]
        [Category("PostSubject")]
        public Color DateAuthorForeColor
        {
            get
            {
                if (ViewState["DateAuthorForeColor"] != null)
                {
                    return (Color)ViewState["DateAuthorForeColor"];
                }
                return ColorTranslator.FromHtml("#666666");
            }
            set
            {
                ViewState["DateAuthorForeColor"] = value;
            }
        }
      
        [DefaultValue(typeof(System.Drawing.Color), "#5C80B1")]
        [Description("The post subject color")]
        [Category("PostSubject")]
        public Color SubjectForeColor
        {
            get
            {
                if (ViewState["SubjectColor"] != null)
                {
                    return (Color)ViewState["SubjectColor"];
                }
                return ColorTranslator.FromHtml("#5C9EDC");
            }
            set
            {
                ViewState["SubjectColor"] = value;
            }
        }
      
        #endregion
        #region PostBody

        /// <summary>
        /// Post body css class on preview page
        /// </summary>
        [Description("The number of characters to display from each post body in case \"ShowFullBlogsOnPreivewPage\" was set to false")]
        [Category("PostBody")]
        [DefaultValue(512)]
        public int NumberOfCharsToDisplayForEachPostPreview
        {
            get
            {
                if (ViewState["NumberOfCharsToDisplayForEachPostPreview"] != null)
                {
                    return (int)ViewState["NumberOfCharsToDisplayForEachPostPreview"];
                }
                else return 512;


            }
            set
            {
                ViewState["NumberOfCharsToDisplayForEachPostPreview"] = value;
            }
        }

        /// <summary>
        /// Post body css class on preview page
        /// </summary>
        [Description("Post body css class on preview page")]
        [Category("PostBody")]
        public string PreviewPagePostBodyCSS
        {
            get
            {
                if (ViewState["PreviewPagePostBodyCSS"] != null)
                {
                    return (string)ViewState["PreviewPagePostBodyCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["PreviewPagePostBodyCSS"] = value;
            }
        }
        
        [DefaultValue(true)]
        [Description("Show full posts body on the preview page")]
        [Category("PostBody")]
        public bool ShowFullBlogsOnPreivewPage
        {
            get
            {
                if (ViewState["ShowFullBlogsOnPreivewPage"] != null)
                {
                    return (bool)ViewState["ShowFullBlogsOnPreivewPage"];
                }
                return true;
            }
            set
            {
                ViewState["ShowFullBlogsOnPreivewPage"] = value;
            }
        }
        private Style _styleBody;
        private FontInfo _bodyFont;
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [Category("PostBody")]
        [NotifyParentProperty(true)]
        [Description("The font of the post body")]
        public FontInfo BodyFont
        {
            get
            {
                if (_styleBody == null)
                {
                    if (ViewState["BodyFont"] != null)
                    {

                    }
                    _styleBody = new Style();
                    _bodyFont = _styleBody.Font;
                    _bodyFont.Name = "Verdana";
                    _bodyFont.Size = FontUnit.Parse("11px");
                }
                return _bodyFont;
            }
            set
            {
                ViewState["BodyFont"] = value;
                _bodyFont = value;
            }
        }

        [Category("PostBody")]
       [DefaultValue(typeof(Color),"Silver")]
        [Description("The border color of the post body")]
        public Color BodyBorderColor
        {
            get
            {
                if (ViewState["BodyBorderColor"] != null)
                {
                    return (Color)ViewState["BodyBorderColor"];
                }
                return Color.Silver;
            }
            set
            {
                ViewState["BodyBorderColor"] = value;
            }
        }

        [Category("PostBody")]
        [DefaultValue(typeof(BorderStyle), "Solid")]
        [Description("The border style of the post body")]
        public BorderStyle BodyBorderStyle
        {
            get
            {
                if (ViewState["BodyBorderStyle"] != null)
                {

                    return (BorderStyle)ViewState["BodyBorderStyle"];
                }
                return BorderStyle.Solid;
            }
            set
            {
                ViewState["BodyBorderStyle"] = value;
            }
        }

        [Category("PostBody")]
        [DefaultValue("1px")]
        [Description("The border width of the post body")]
        public string BodyBorderWidth
        {
            get
            {
                if (ViewState["BodyBorderWidth"] != null)
                {

                    return (string)ViewState["BodyBorderWidth"];
                }
                return "1px";
            }
            set
            {
                ViewState["BodyBorderWidth"] = value;
            }
        }
         
        [Category("PostBody")]
        [DefaultValue(typeof(Color),"Silver")]
        [Description("The color of the post body")]
        public Color BodyForeColor
        {
            get
            {
                if (ViewState["BodyForeColor"] != null)
                {

                    return (Color)ViewState["BodyForeColor"];
                }
                return Color.Silver;
            }
            set
            {
                ViewState["BodyForeColor"] = value;
            }
        }

        #endregion
        #region SinglePostView

        /// <summary>
        /// Display a "back" button on a single post view page
        /// </summary>
        [DefaultValue(true)]
        [Description("Show the \"Back\" button the a single post view")]
        [Category("SinglePostView")]
        public bool ShowBackButtonOnPostView
        {
            get
            {
                if (ViewState["ShowBackButtonOnPostView"] != null)
                {
                    return (bool)ViewState["ShowBackButtonOnPostView"];
                }
                return true;
            }
            set
            {
                ViewState["ShowBackButtonOnPostView"] = value;
            }
        }

        /// <summary>
        /// Allow users to click on the post title for
        /// viewing the full post in a separate page
        /// </summary>
        [DefaultValue(true)]
        [Description("Allow users to click on the post title for viewing the full post in a separate page")]
        [Category("SinglePostView")]
        public bool AllowSinglePostView
        {
            get
            {
                if (ViewState["AllowSinglePostView"] != null)
                {
                    return (bool)ViewState["AllowSinglePostView"];
                }
                return true;
            }
            set
            {
                ViewState["AllowSinglePostView"] = value;
            }
        }

        #endregion
        #region NewPost
        /// <summary>
        /// The text on the AddPost button
        /// </summary>
        [DefaultValue("Add Post")]
        [Description("The text on the \"AddPost\" button")]
        [Category("NewPost")]
        public string AddPostButtonText
        {
            get
            {
                if (ViewState["_addPostButtonText"] != null)
                {
                    return (string)ViewState["_addPostButtonText"];
                }
                else return "Add Post";


            }
            set
            {
                ViewState["_addPostButtonText"] = value;
            }
        }

        /// <summary>
        /// The font color on the AddPost box
        /// </summary>
        [DefaultValue(typeof(Color), "Black")]
        [Description("The text color on the Add Post box")]
        [Category("NewPost")]
        public Color AddPostTextColor
        {
            get
            {
                if (ViewState["AddPostTextColor"] != null)
                {
                    return (Color)ViewState["AddPostTextColor"];
                }
                else return Color.Black;


            }
            set
            {
                ViewState["AddPostTextColor"] = value;
            }
        }
        
        /// <summary>
        /// The text of the "User name" in add new post
        /// </summary>
        [DefaultValue("User Name")]
        [Description("The text of the \"User name\" in add new post")]
        [Category("NewPost")]
        public string AddPostWriterText
        {
            get
            {
                if (ViewState["AddPostWriterText"] != null)
                {
                    return (string)ViewState["AddPostWriterText"];
                }
                return "User Name";
            }
            set
            {
                ViewState["AddPostWriterText"] = value;
            }
        }

        /// <summary>
        /// The text of the "Subject" in add new post
        /// </summary>
        [DefaultValue("Subject")]
        [Description("The text of the \"Subject\" in add new post")]
        [Category("NewPost")]
        public string AddPostSubjectText
        {
            get
            {
                if (ViewState["AddPostSubjectText"] != null)
                {
                    return (string)ViewState["AddPostSubjectText"];
                }
                return "Subject";
            }
            set
            {
                ViewState["AddPostSubjectText"] = value;
            }
        }


        /// <summary>
        /// The text of the "Cancel" button in add new post
        /// </summary>
        [DefaultValue("Cancel")]
        [Description("The text of the \"Cancel\" in add new post")]
        [Category("NewPost")]
        public string AddPostCancelText
        {
            get
            {
                if (ViewState["AddPostCancelText"] != null)
                {
                    return (string)ViewState["AddPostCancelText"];
                }
                return "Cancel";
            }
            set
            {
                ViewState["AddPostCancelText"] = value;
            }
        }

       
        /// <summary>
        /// The text of to display after a successfull new post
        /// </summary>
        [DefaultValue("The post was saved successfully!")]
        [Description("The text of to display after a successfull new post")]
        [Category("NewPost")]
        public string AddPostSuccessText
        {
            get
            {
                if (ViewState["AddPostSuccessText"] != null)
                {
                    return (string)ViewState["AddPostSuccessText"];
                }
                return "The post was saved successfully!";
            }
            set
            {
                ViewState["AddPostSuccessText"] = value;
            }
        }

        /// <summary>
        /// The text on the "Back" button after a successfull new post
        /// </summary>
        [DefaultValue("Back")]
        [Description("The text on the \"Back\" button after a successfull new post")]
        [Category("NewPost")]
        public string AddPostBackButtonText
        {
            get
            {
                if (ViewState["AddPostBackButtonText"] != null)
                {
                    return (string)ViewState["AddPostBackButtonText"];
                }
                return "Back";
            }
            set
            {
                ViewState["AddPostBackButtonText"] = value;
            }
        }

        /// <summary>
        /// The text of the "Submit" button in add new post
        /// </summary>
        [DefaultValue("Submit")]
        [Description("The text on the \"Submit\" button in add new post")]
        [Category("NewPost")]
        public string AddPostSubmitText
        {
            get
            {
                if (ViewState["AddPostSubmitText"] != null)
                {
                    return (string)ViewState["AddPostSubmitText"];
                }
                return "Submit";
            }
            set
            {
                ViewState["AddPostSubmitText"] = value;
            }
        }
        /// <summary>
        /// The css class of the add new post box
        /// </summary>
        [Description("The css class of the add new post box")]
        [Category("NewPost")]
        public string AddPostCSS
        {
            get
            {
                if (ViewState["AddPostCSS"] != null)
                {
                    return (string)ViewState["AddPostCSS"];
                }
                return null;
            }
            set
            {
                ViewState["AddPostCSS"] = value;
            }
        }
        /// <summary>
        /// Show AddPost button
        /// </summary>
        [DefaultValue(true)]
        [Description("Show the \"AddPost\" button")]
        [Category("NewPost")]
        public bool ShowAddPostButton
        {
            get
            {
                if (ViewState["_showAddPostButton"] != null)
                {
                    return (bool)ViewState["_showAddPostButton"];
                }
                return true;
            }
            set
            {
                ViewState["_showAddPostButton"] = value;
            }
        }
        /// <summary>
        /// The text of the "Body" in add new post
        /// </summary>
        [DefaultValue("Body")]
        [Description("The text of the \"Body\" label in add new post")]
        [Category("NewPost")]
        public string AddPostBodyText
        {
            get
            {
                if (ViewState["AddPostBodyText"] != null)
                {
                    return (string)ViewState["AddPostBodyText"];
                }
                return "Body";
            }
            set
            {
                ViewState["AddPostBodyText"] = value;
            }
        }
        #endregion
        #region Paging
        /// <summary>
        /// Pager links color
        /// </summary>
        [DefaultValue(typeof(Color),"Gray")]
        [Description("Pager links color")]
        [Category("Paging")]
        public Color PagerColor
        {
            get
            {
                if (ViewState["PagerColor"] != null)
                {
                    return (Color)ViewState["PagerColor"];
                }
                else return Color.Gray;


            }
            set
            {
                ViewState["PagerColor"] = value;
            }
        }
        /// <summary>
        /// Pager selected page color
        /// </summary>
        [DefaultValue(typeof(Color), "Black")]
        [Description("Pager selecte page link color")]
        [Category("Paging")]
        public Color PagerSelectedPageColor
        {
            get
            {
                if (ViewState["PagerSelectedPageColor"] != null)
                {
                    return (Color)ViewState["PagerSelectedPageColor"];
                }
                else return Color.Black;


            }
            set
            {
                ViewState["PagerSelectedPageColor"] = value;
            }
        }
        /// <summary>
        /// Pager css class
        /// </summary>
        [Description("Pager Css Class")]
        [Category("Paging")]
        public string PagerCSS
        {
            get
            {
                if (ViewState["PagerCSS"] != null)
                {
                    return (string)ViewState["PagerCSS"];
                }
                else return null;


            }
            set
            {
                ViewState["PagerCSS"] = value;
            }
        }

        /// <summary>
        /// First page index number
        /// </summary>
        [DefaultValue(0)]
        [Description("First page index number")]
        [Category("Paging")]
        public int PageIndex
        {
            get
            {
                if (ViewState["PageIndex"] != null)
                    return (int)ViewState["PageIndex"];
                else
                    return 0;
            }
            set
            {
                ViewState["PageIndex"] = value;
            }
        }

        /// <summary>
        /// Allow Paging
        /// </summary>
        [DefaultValue(false)]
        [Description("Allow Paging")]
        [Category("Paging")]
        public bool AllowPaging
        {
            get
            {
                if (ViewState["AllowPaging"] != null)
                {
                    return (bool)ViewState["AllowPaging"];
                }
                return false;
            }
            set
            {
                ViewState["AllowPaging"] = value;
            }
        }
        /// <summary>
        /// The number of posts previews to display on preview page 
        /// in case a pagings has been enables
        /// </summary>
        [DefaultValue(15)]
        [Description(" The number of posts previews to display on preview page")]
        [Category("Paging")]
        public int PostsPerPage
        {
            get
            {
                if (ViewState["PostsPerPage"] != null)
                    return (int)ViewState["PostsPerPage"];
                else
                    return 15;
            }
            set
            {
                ViewState["PostsPerPage"] = value;
            }
        }
        /// <summary>
        /// Pager location
        /// </summary>        
        [DefaultValue(PagerPosition.Bottom)]
        [Description("Pager location")]
        [Category("Paging")]
        public PagerPosition PagerLocation
        {
            get
            {
                if (ViewState["PagerLocation"] != null)
                {
                    return (PagerPosition)ViewState["PagerLocation"];
                }
                return PagerPosition.Bottom;
            }
            set
            {
                ViewState["PagerLocation"] = value;
            }
        }

        /// <summary>
        /// Pager mode
        /// </summary>
        [DefaultValue(PagerMode.NumericPages)]
        [Description("Pager mode")]
        [Category("Paging")]
        public PagerMode Mode
        {
            get
            {
                if (ViewState["PagerMode"] != null)
                {
                    return (PagerMode)ViewState["PagerMode"];
                }
                return PagerMode.NumericPages;
            }
            set
            {
                ViewState["PagerMode"] = value;
            }
        }

        /// <summary>
        /// Pager settings - next page text
        /// </summary>
        [DefaultValue("&gt;")]
        [Description("next page text")]
        [Category("Paging")]
        public string NextPageText
        {
            get
            {
                if (ViewState["NextPageText"] != null)
                {
                    return (string)ViewState["NextPageText"];
                }
                else return "&gt;";


            }
            set
            {
                ViewState["NextPageText"] = value;
            }
        }

        /// <summary>
        /// Pager settings - previous page text
        /// </summary>
        [DefaultValue("&lt;")]
        [Description("previous page text")]
        [Category("Paging")]
        public string PreviousPageText
        {
            get
            {
                if (ViewState["PreviousPageText"] != null)
                {
                    return (string)ViewState["PreviousPageText"];
                }
                else return "&lt;";


            }
            set
            {
                ViewState["PreviousPageText"] = value;
            }
        }

        /// <summary>
        /// Pager settings - show pager
        /// </summary>
        [DefaultValue(true)]
        [Description("show pager")]
        [Category("Paging")]
        public bool PagerVisible
        {
            get
            {
                if (ViewState["PagerVisible"] != null)
                {
                    return (bool)ViewState["PagerVisible"];
                }
                else return true;


            }
            set
            {
                ViewState["PagerVisible"] = value;
            }
        }
        #endregion

        #region Permalink

        [Description("Permalink CSS")]
        [Category("Permalink")]
        public string PermalinkCSS
        {
            get
            {
                if (ViewState["PermalinkCSS"] != null)
                {
                    return (string)ViewState["PermalinkCSS"];
                }
                else return "PermalinkCSS";


            }
            set
            {
                ViewState["PermalinkCSS"] = value;
            }
        }
        /// <summary>
        /// Pager settings - previous page text
        /// </summary>
        [DefaultValue("Permalink")]
        [Description("Permalink text")]
        [Category("Permalink")]
        public string PermalinkText
        {
            get
            {
                if (ViewState["PermalinkText"] != null)
                {
                    return (string)ViewState["PermalinkText"];
                }
                else return "Permalink";


            }
            set
            {
                ViewState["PermalinkText"] = value;
            }
        }

        /// <summary>
        /// Pager settings - show pager
        /// </summary>
        [DefaultValue(true)]
        [Description("Show Permalink")]
        [Category("Permalink")]
        public bool ShowPermalink
        {
            get
            {
                if (ViewState["ShowPermalink"] != null)
                {
                    return (bool)ViewState["ShowPermalink"];
                }
                else return true;


            }
            set
            {
                ViewState["ShowPermalink"] = value;
            }
        }

        private Style _stylePermalink;
        private FontInfo _PermalinkFont;
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
        [Category("Permalink")]
        [NotifyParentProperty(true)]
        [Description("The font for the Permalink")]
        public FontInfo PermalinkFont
        {
            get
            {
                if (_stylePermalink == null)
                {
                    if (ViewState["PermalinkFont"] != null)
                    {

                    }
                    _stylePermalink = new Style();
                    _PermalinkFont = _stylePermalink.Font;
                    _PermalinkFont.Name = "Verdana";
                    _PermalinkFont.Size = FontUnit.Parse("11px");
                }
                return _PermalinkFont;
            }
            set
            {
                ViewState["PermalinkFont"] = value;
                _PermalinkFont = value;
            }
        }

        [DefaultValue(typeof(System.Drawing.Color), "#5c80b1")]
        [Description("The Permalink color")]
        [Category("Permalink")]
        public Color PermalinkColor
        {
            get
            {
                if (ViewState["PermalinkColor"] != null)
                {
                    return (Color)ViewState["PermalinkColor"];
                }
                return ColorTranslator.FromHtml("#5c80b1");
            }
            set
            {
                ViewState["PermalinkColor"] = value;
            }
        }
        #endregion
    }
}